NVM.Pannellum = (function () {
    var __core = NOVEM.Core;
    var __base = NOVEM.Base;
    var __modules = NOVEM.Modules;

    return {
        init: function (selector) {
            if (__core.getSelector(selector, false, false).length < 1) {
                return true;
            }

            __core.loadJS({
                file: "plugins/pannellum.js",
                id: "nvm-pannellum-js",
                jsFolder: true,
            });

            __core.isFuncTrue(function () {
                return typeof pannellum !== "undefined";
            }).then(function (cond) {
                if (!cond) {
                    return false;
                }
                __core.initFunction({ class: 'has-plugin-pannellum', event: 'pluginPannellumReady' });

                selector = __core.getSelector(selector, false);
                if (selector.length < 1) {
                    return true;
                }

                selector.forEach(function (element) {
                    pannellum.viewer(element.id, {
                        type: "equirectangular",
                        panorama: element.dataset.panorama,
                        preview: element.dataset.preview,
                        autoLoad: true,
                        autoRotate: -5,
                        autoRotateInactivityDelay: 10,
                        showControls: false,
                        hfov: 120,
                    });
                })
            })
        },
    };
})();